From 43ad03892a948823435fd0d5a76f1a3e050c2fd9 Mon Sep 17 00:00:00 2001 From: Samuel Martin Date: Sat, 23 Sep 2017 11:27:52 +0200 Subject: fslibre: set measure_method when parsing records --- glucometerutils/drivers/fslibre.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/glucometerutils/drivers/fslibre.py b/glucometerutils/drivers/fslibre.py index c8b8c5e..c4c5365 100644 --- a/glucometerutils/drivers/fslibre.py +++ b/glucometerutils/drivers/fslibre.py @@ -113,11 +113,14 @@ def _parse_arresult(record): return None comment_parts = [] + measure_method = None if parsed_record['reading-type'] == 2: comment_parts.append('(Scan)') + measure_method = common.CGM elif parsed_record['reading-type'] == 0: comment_parts.append('(Blood)') + measure_method = common.BLOOD_SAMPLE else: # ketone reading return None @@ -161,7 +164,8 @@ def _parse_arresult(record): return common.GlucoseReading( _extract_timestamp(parsed_record), parsed_record['value'], - comment='; '.join(comment_parts)) + comment='; '.join(comment_parts), + measure_method=measure_method) class Device(freestyle.FreeStyleHidDevice): """Glucometer driver for FreeStyle Libre devices.""" @@ -201,7 +205,8 @@ class Device(freestyle.FreeStyleHidDevice): yield common.GlucoseReading( _extract_timestamp(parsed_record), parsed_record['value'], - comment='(Sensor)') + comment='(Sensor)', + measure_method=common.CGM) # Then get the results of explicit scans and blood tests (and other # events). -- cgit v1.2.3